package com.ctyun.xstore.vod;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.annotation.JSONField;

public abstract class AbstractVODRequest {

	private final Map<String, List<String>> headers = new HashMap<>();

	private String cipherPass;

	public void addHeader(String header, String value) {
		synchronized (headers) {
			if (!headers.containsKey(header)) {
				headers.put(header, new ArrayList<>());
			}
			headers.get(header).add(value);
		}
	}

	public void setHeader(String header, String value) {
		synchronized (headers) {
			List<String> values = new ArrayList<>();
			values.add(value);
			headers.put(header, values);
		}
	}

	@JSONField(serialize = false)
	public Map<String, List<String>> getHeaders() {
		return headers;
	}

	@JSONField(serialize = false)
	public String getCipherPass() {
		return cipherPass;
	}

	public void setCipherPass(String cipherPass) {
		this.cipherPass = cipherPass;
	}

	@JSONField(serialize = false)
	public boolean isEncrypt() {
		return (null != this.cipherPass) && (!"".equals(this.cipherPass));
	}

	protected abstract String getPath();
}
